<?
include("../lib/config.php");
//$nik 	= $HTTP_GET_VARS['nik'];
$op		= $HTTP_GET_VARS['op'];
$KL		= $HTTP_GET_VARS['KL'];

if($op == "edit"){
	$Faction = "../lib/update.php";
	$Vbutton = "Update";
	$query	= mssql_query("SELECT * FROM MstLokasi WHERE kode_lokasi='$KL'",$conn);
	$row	= mssql_fetch_array($query);
}
else{
	$Faction = "../lib/save.php";
	$Vbutton = "Simpan";
}

include("../header.php");
?>
<script type="text/javascript" language="javascript">
	function Validate(){
		if(document.FEmployee.kode_lokasi.value == "")
		{
			alert("Field : Kode Lokasi tidak boleh kosong ...");
			document.FEmployee.kode_lokasi.focus();
			return false;
		}
		
		if(document.FEmployee.distrik.value == "")
		{
			alert("Field : Distrik tidak boleh kosong ...");
			document.FEmployee.distrik.focus();
			return false;
		}

		document.FEmployee.submit();

	}
</script>
</head>
<form name="FEmployee" method="post" action="<?=$Faction?>">
<table width="100%" class="no_border">
 <tr>
  <td colspan="2">
	<table width="100%" style="border:none;">
	<tr>
	 <td colspan="2" class="line_bottom">&nbsp;&nbsp;<b>PARAMETER LOKASI</td>
	</tr>
	</table>
  </td>
  </td>
 </tr>
 <tr>
  <td>&nbsp;</td>
 </tr>
 <tr>
  <td>
 <table cellpadding="2" cellspacing="0" width="91%">
 <tr>
  <td width="150">Kode Lokasi:</td>
  <td><input type="text" name="kode_lokasi" maxlength="50" value="<?=$row[kode_lokasi]?>" 
  <?
  if($op == "edit")
  { echo"readonly"; } 
  else{ }
  ?> /> <span class="required">*</span></td>
 </tr>
 <tr>
  <td>Distrik:</td>
  <td><input type="text" name="distrik" size="75" maxlength="200" value="<?=$row[distrik]?>" /> <span class="required">*</span></td>
 </tr>
 <tr>
  <td>Propinsi:</td>
  <td>
  <select name="propinsi">
<?
	$sqlPr = mssql_query("SELECT * FROM VPropinsi WHERE nama_propinsi='$row[propinsi]'",$conn);
	$rowPr = mssql_fetch_array($sqlPr);
	echo"<option value='$rowPr[nama_propinsi]'>$rowPr[nama_propinsi]</option>";
?>  
   <option value="">--pilih--</option>
<?
   $sqlProp = mssql_query("SELECT * FROM VPropinsi Order By nama_propinsi",$conn);
   while($rowProp = mssql_fetch_array($sqlProp)){
   	echo"<option value='$rowProp[nama_propinsi]'>$rowProp[nama_propinsi]</option>";
   }	
?>
  </select>
  </td>
 </tr>
 <tr>
  <td>&nbsp;</td>
  <td align="right"><input type="hidden" name="nik" value="<?=$nik?>" />
  <input type="hidden" name="cat" value="par_lokasi" />
  <input type="hidden" name="no" value="<?=$row[No]?>" />
  <input type="button" value="Batal" onclick="Javascript:history.back();" class="button" />
  <input type="reset" value="Reset" class="button"/><input type="button" value="<?=$Vbutton?>" class="button" onClick="Validate();" />
  <br /><br />
  </td>
 </tr>
</table>
</form>
</td>
</tr>
<tr>
 <td colspan="2" style="border:none;"><? include("../footer.php"); ?></td>
</tr>
</table>
<?
echo"</div>
	  </td>
	   </tr>
	    </table>
";
include("../menu.php");
?>